//
//  GYJournal.h
//  LockManagement
//
//  Created by apple on 2018/8/20.
//  Copyright © 2018年 yunjiazhineng. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface GYJournal : NSObject

/** 日志ID */
@property (nonatomic, strong) NSString *logID;

/** 日志时间 */
@property (nonatomic, strong) NSString *logTime;

/** 日志类型 */
@property (nonatomic, assign) int logType;

/** 用户ID */
@property (nonatomic, strong) NSString *userID;

/** 用户名 */
@property (nonatomic, strong) NSString *userName;

/** 钥匙ID */
@property (nonatomic, strong) NSString *keyID;

/** 钥匙名字 */
@property (nonatomic, strong) NSString *keyName;

/** 锁具ID */
@property (nonatomic, strong) NSString *lockID;

/** 锁具名字 */
@property (nonatomic, strong) NSString *lockName;

/** 日志状态 */
@property (nonatomic, assign) int logState;

/** 日志上传时间 */
@property (nonatomic, strong) NSString *upTime;

/** 标记条数的是属于那一天的日期 用于数据库的快速查询 */
@property (nonatomic, strong) NSString *currentDate;

/**
 得到日子列表

 @param beginTime <#beginTime description#>
 @param endTime <#endTime description#>
 @param current <#current description#>
 @param pageSize <#pageSize description#>
 @param success <#success description#>
 @param failed <#failed description#>
 */
+ (void)getJournalList:(NSString *)beginTime endTime:(NSString *)endTime current:(NSString *)current pageSize:(NSString *)pageSize success:(void(^)(NSArray *journals, NSInteger totalItems))success error:(void(^)(NSError *error))failed;


#pragma mark -- 数据库的操作

/**
 创建一个日志数据表
 
 @return 是否成功
 */
+ (BOOL)createJournalTable;

/**
 插入一条日志数据
 
 @param journal 日志对象
 */
+ (void)insertJournal:(GYJournal *)journal;

/**
 得到数据库中所有的日志数据
 */
+ (NSArray<GYJournal *> *)getAllJournalData:(NSString *)condition;

@end
